package com.sensePlusVR.net;

import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONObject;

import com.loopj.android.http.JsonHttpResponseHandler;
/**
 * 
 * @author: Loren
 * @create: 2016-6-14下午1:20:09
 * @desc: 访问网络回调再次封装
 *
 */
@SuppressWarnings({"deprecation","unused"})
public class NetCallBack extends JsonHttpResponseHandler {
	private static final String TAG = NetCallBack.class.getSimpleName();
	
	@Override
	public void onStart() {
		//MyLog.d(TAG, "onStart...");
		onMyStart();
		super.onStart();
	}

	@Override
	public void onSuccess(int statusCode, Header[] aheader, JSONObject jsonobject) {
		//MyLog.d(TAG, "onSuccess...");
		onMySuccess(statusCode, aheader, jsonobject);
		super.onSuccess(statusCode, aheader, jsonobject);
	}
	
	@Override
	public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
		//MyLog.d(TAG, "onSuccess...");
		onMySuccess(statusCode, headers, response);
		super.onSuccess(statusCode, headers, response);
	}

	@Override
	public void onSuccess(int statusCode, Header[] headers,
			String responseString) {
		//MyLog.d(TAG, "onSuccess...");
		onMySuccess(statusCode, headers, responseString);
		super.onSuccess(statusCode, headers, responseString);
	}

	@Override
	public void onFailure(int i, Header[] aheader, String s,
			Throwable throwable1) {
		//MyLog.e(TAG, "onFailure...");
		onMyFailure(i, aheader, s, throwable1);
		super.onFailure(i, aheader, s, throwable1);
	}
	@Override
	public void onFailure(int statusCode, Header[] headers,
			Throwable throwable, JSONObject errorResponse) {
		//MyLog.e(TAG, "onFailure...");
		onMyFailure(statusCode, headers, throwable, errorResponse);
		super.onFailure(statusCode, headers, throwable, errorResponse);
		
	}
	
	@Override
	public void onFailure(int statusCode, Header[] headers,
			Throwable throwable, JSONArray errorResponse) {
		//MyLog.e(TAG, "onFailure...");
		onMyFailure(statusCode, headers, throwable, errorResponse);
		super.onFailure(statusCode, headers, throwable, errorResponse);
	}
	
	
	
	@Override
	public void onCancel() {
		//MyLog.d(TAG, "onCancel...");
		onMyCancel();
		super.onCancel();
	}
	
	@Override
	public void onFinish() {
		//MyLog.d(TAG, "onFinish...");
		onMyFinish();
		super.onFinish();
	}
	
	@Override
	public void onProgress(int bytesWritten, int totalSize) {
		//MyLog.d(TAG, "onProgress...");
		onMyProgress(bytesWritten, totalSize);
		super.onProgress(bytesWritten, totalSize);
	}
	
	@Override
	public void onRetry(int retryNo) {
		//MyLog.d(TAG, "onRetry...");
		onMyRetry(retryNo);
		super.onRetry(retryNo);
	}
	
	//---------------------------------------------------------------------------------

	public void onMyStart(){
		//MyLog.d(TAG, "onMyStart...");
	};
	
	public void onMySuccess(int statusCode, Header[] aheader, JSONObject jsonobject){
		//MyLog.d(TAG, "onMySuccess statusState : " + statusCode);
	}
	
	public void onMySuccess(int statusCode, Header[] headers,
			JSONArray response) {
		//MyLog.d(TAG, "onMySuccess statusState : " + statusCode);
	}
	
	
	public void onMySuccess(int statusCode, Header[] headers,
			String responseString) {
		//MyLog.d(TAG, "onMySuccess statusState : " + statusCode);
	}

	public void onMyFailure(int statusCode, Header[] aheader, String s,Throwable throwable1){
		//MyLog.e(TAG, "onMyFailure statusCode : " + statusCode);
	};
	
	public void onMyFailure(int statusCode, Header[] headers,
			Throwable throwable, JSONObject errorResponse){
		//MyLog.e(TAG, "onMyFailure statusState : " + statusCode);
	};
	

	public void onMyFailure(int statusCode, Header[] headers,
			Throwable throwable, JSONArray errorResponse) {
		//MyLog.e(TAG, "onMyFailure statusState : " + statusCode);
	}
	
	public void onMyCancel() {
		//MyLog.d(TAG, "onMyCancel...");
	}
	
	public void onMyFinish() {
		//MyLog.d(TAG, "onMyFinish...");
	}
	
	public void onMyProgress(int bytesWritten, int totalSize) {
		//MyLog.d(TAG, "onMyProgress...");
	}
	
	public void onMyRetry(int retryNo) {
		//MyLog.d(TAG, "onMyRetry...");
	}
}
